<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div></div>

    <script>
        // 1. 获取元素
        let div = document.querySelector('div');

        function a(content) {
            console.log(content);
        }
        // 2. 手指触摸DOM元素事件
        div.addEventListener('touchstart', function (e) {
            // 5.1 
            console.log(e);
            console.log('我摸了你');
        });

        // 3. 滑动
        div.addEventListener('touchmove', function () {
            console.log('我滑了你');
        });
        // 4. 离开，但效果是松开鼠标；
        // div.addEventListener('touchend', a('移开')); 这么写，怎么都是一刷新就是移开
        div.addEventListener('touchend', function () {
            a('移开');
        });
    </script>
</body>

</html>